<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateO2oGoodsTable1554107680 extends Migration
{
    /**
     * 积分-门店关系表 
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        $prefix = config('ibrand.app.database.prefix', 'ibrand_');
        if(!Schema::hasTable($prefix.'o2o_goods')){
	        Schema::create($prefix.'o2o_goods', function (Blueprint $table) {
		        $table->increments('id');
		        $table->integer('goods_id'); //el_goods表主键
		        $table->tinyInteger('status')->default(1); //上架状态：1 上架；0 下架
		        $table->integer('store_nums')->default(0); //总库存
		        $table->integer('shop_id')->default(0); //店铺ID
		        $table->tinyInteger('is_discount')->default(0); //是否是特价商品
		        $table->decimal('price')->default(0); //进货价
		        $table->tinyInteger('point_deduction')->default(1); //是否可使用积分抵扣
		        $table->timestamps();
	        });
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        $prefix = config('ibrand.app.database.prefix', 'ibrand_');
        Schema::drop($prefix.'o2o_goods');
    }
}
